<!-- 重点企业 -->
<template>
  <div class="page-box h100 display-flex czbj">
      <p class="title-label mb10">重点企业</p>
      <dxtable :dataJson="dataJson" :portUrl="portUrl" :formJson="formJson" :qx="qx" ref="databale" :czFun="czFun" czWidth="220"></dxtable>
      <!-- :czFun="czFun" -->
  </div>
</template>
<script lang='ts' setup>
import { leixing } from "../../util/config";
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget,dxpost } from "../../util/index";
import { NButton,NImage,NTag } from "naive-ui"
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
const sshhs = ref([])
let qxList = ref([]);
let dataJson = [
{
      title: "企业logo",
      key: "logo",
      width:150,
      render(row) {
       try{
        row.banner= row.banner.split(",")
       }catch(e){
      
       }
     
        return  h(NImage,{src:row.logo,class:"iconsder"})
      },
  },
  {
      title: "所属行业",
      key: "name",
      key: "cid",
      type: "select",
      options:[],
      width: 200,
      search: true, // 是否在搜索栏展示
      render(row){
        try{
          return sshhs.value.filter(a=>a.value==row.cid)[0].label
        }catch(e){
          return '--'
        }
      }
  },
  {
      title: "企业名称",
      key: "name",
      width: 200,
      search: true, // 是否在搜索栏展示
  },
  {
      title: "地址",
      key: "qyaddress",
  },
  {
      title: "标签",
      key: "tag",
      render(row){
        try{
        row.tag= row.tag.split(",")
       }catch(e){
      
       }
       const jmxxd =[]
       row.tag.map(a=>{
        jmxxd.push(h(NTag,{class:"ml10",type:"success"},a))
       })
        return jmxxd
      }
  },
  {
     title: "排序",
     width: 100,
     render(row) {
       row.databaseName = "keyEnterprise";
       row.sjk = "xtgx"
       return h(sort, {
         row,
         onCallBack: () => {
           initeer();
         },
       });
     },
   },
  {
      title: "添加时间",
      key: "addTime",
      width: 150,
  },
];
const qx = {
  DeletePermissionID: "xtgxkeyEnterprisedel", //删除
  EditPermissionIdentifier: "xtgxkeyEnterprisebj", // 编辑
  NewPermissionIdentifier: "xtgxkeyEnterprisexz", // 新建
  ViewPermissionID: "xtgxkeyEnterpriseck", // 查看
};
// const portUrl = "dxgjAdmin/administrator?CharacterNameCode=" + leixing;
const portUrl = "xtgx/keyEnterprise";
let formJson = reactive([
{
      title: "企业logo",
      key: "logo",
      type: "img",
      required: true, // 是否为必填
      val: ""
  },
  {
      title: "所属行业",
      key: "cid",
      type: "select",
      options:[],
      val: 10000
  },
  {
      title: "企业名称",
      type: "input",
      required: true, // 是否为必填
      key: "name",
      span:"24"
  },

  {
      title: "企业地址",
      type: "input",
      required: true, // 是否为必填
      key: "qyaddress",
      span:"24"
  },
  
  {
      title: "图片介绍",
      key: "banner",
      type: "imglist",
      val: []
  },
  {
      title: "标签",
      key: "tag",
      type: "Tags",
      val: []
  },
  
  {
      title: "简介",
      key: "intro",
      type: "fwb",
  }
]);



const czFun = {
  fun: (row) => {
    
  },
};

const getzdhy = async()=>{
  const {data}:any = await dxget("xtgx/api/getzdhy")
  console.log(data);
  dataJson[1].options = [
    {
      label:"全部",
      value:""
    },
    ...data
  ]
  formJson[1].options = data
  sshhs.value = data
}
getzdhy()


</script>
<style scoped></style>